package com.jf3q.common.config;

import com.aliyun.teaopenapi.models.Config;
import com.aliyun.vod20170321.Client;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class aliyunConfig {

    @Value("${ali.endpoint}")
    String endpoint;
    @Value("${ali.bucketName}")
    String bucketName;
    @Value("${ali.accessKeyId}")
    String accessKeyId;
    @Value("${ali.secretAccessKey}")
    String secretAccessKey;

    String regionId = "cn-hangzhou";

    @Bean
    public Client Initialization() throws Exception {
        Config config = new Config();
        // 您的AccessKey ID
        config.accessKeyId = this.accessKeyId;
        // 您的AccessKey Secret
        config.accessKeySecret = this.secretAccessKey;
        // 您的可用区ID
        config.regionId = regionId;
        return new Client(config);
    }

}
